There are multiple resource-providing entities in a distributed resource system. Resources include a computing capability of a Central Processing Unit (CPU), hard disk space, memory space, network bandwidth, and the like, where a resource may be a physical resource or a virtual resource. When a resource-providing entity provides a resource according to a user request, a resource competition occurs between users. Therefore, scheduling a user request to ensure performance for users becomes extremely important.
FIG. 1 shows a user request scheduling solution, where a distributed resource system shown in FIG. 1 is a distributed file system and includes a user agent A, a user agent B, a scheduler A, a scheduler B, a resource-providing entity A, and a resource-providing entity B, where the user agent A does not communicate with the user agent B. The user agent A queries a metadata server in the distributed file system according to a user A request, and the user agent A determines, according to information obtained by querying, a scheduler in FIG. 1 to which the user A request is sent. Likewise, the user agent B queries the metadata server in the distributed file system according to a user B request, and the user agent B determines, according to information obtained by querying, a scheduler in FIG. 1 to which the user B request is sent. The resource-providing entity A and the resource-providing entity B are file systems. The resource-providing entity A is configured to provide a resource A, where the resource A is specifically a capability of providing Input/Output Operations Per Second (IOPS). The resource-providing entity B is configured to provide a resource B, where the resource B is specifically a capability of providing IOPS. A user A and a user B each send a request to the distributed resource system. For example, the user A sends a user A request to each of the resource-providing entity A and the resource-providing entity B by using the user agent A; then, the resource-providing entity A provides the resource A for the user A request, and the resource-providing entity B provides the resource B for the user A request. The user B sends a user B request to each of the resource-providing entity A and the resource-providing entity B by using the user agent B, and the resource-providing entity A and the resource-providing entity B provide the resources for the user B request. When the user A sends the user A request to each of the resource-providing entity A and the resource-providing entity B, in an implementation manner in FIG. 1, the resources provided by the resource-providing entity A and the resource-providing entity B for the user A are both IOPS capabilities. Likewise, the resources provided by the resource-providing entity A and the resource-providing entity B for the user B are also IOPS capabilities.
In the distributed resource system shown in FIG. 1, a resource weight is allocated to each of the user A and the user B. For example, a resource weight of the user A is 2, and a resource weight of the user B is 1. A resource weight of a user indicates a resource quota that is allocated by a distributed resource system to the user. The user agent A collects statistics on a quantity of user A requests that are sent by the user A to the scheduler A and the scheduler B, and the user agent B collects statistics on a quantity of user B requests that are sent by the user B to the scheduler A and the scheduler B. The scheduler A allocates, from the resource-providing entity A, a resource for the user A request according to a resource weight of the user A and the quantity of the user A requests that are sent by the user agent A to the scheduler A and the scheduler B. The scheduler A allocates, from the resource-providing entity A, a resource for the user B request according to a resource weight of the user B and the quantity of the user B requests that are sent by the user agent B to the scheduler A and the scheduler B. Likewise, the scheduler B allocates, from the resource-providing entity B, a resource for the user A request according to the resource weight of the user A and the quantity of the user A requests that are sent by the user agent A to the scheduler A and the scheduler B. The scheduler B allocates, from the resource-providing entity B, a resource for the user B request according to the resource weight of the user B and the quantity of the user B requests that are sent by the user agent B to the scheduler A and the scheduler B.
Because the user agent A and the user agent B are applicable only to a distributed file system scenario, the solution in an architecture shown in FIG. 1 cannot be widely applied to a scenario in which a user request is scheduled in a distributed resource system.